
<template>
  <div class="app-container">

    <span>题库详情列表</span>
    <el-table :data="list" border fit highlight-current-row style="width: 100%">
      <el-table-column align="center" width="90px" label="序号">
        <template slot-scope="{row}">
          <span>{{ row.id }}</span>
        </template>
      </el-table-column>

      <el-table-column  label="题干">
        <template slot-scope="{row}">
          <span>{{ row.num }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作" width="90">
        <template>
          <el-link style="margin-left: 10px" type="primary">
            删除
          </el-link>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      title="添加题库"
      :visible.sync="centerDialogVisible"
      width="30%"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="题库名称">
          <el-input />
        </el-form-item>
        <el-button type="primary">选择试题</el-button>
      </el-form>
      <el-button style="margin-top: 20px" type="primary" @click="centerDialogVisible = false">确 定</el-button>
    </el-dialog>
  </div>
</template>

<script>
import { fetchList } from '@/api/article'

export default {
  name: 'InlineEditTableDetail',
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'info',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    return {
      centerDialogVisible: false,
      list: [
        {
          id: '1',
          num: '题目1：这是一个题目'
        },
        {
          id: '2',
          num: '题目2：这是一个题目'
        },
        {
          id: '3',
          num: '题目3：这是一个题目'
        }
      ],
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 10
      }
    }
  },
  methods: {

    cancelEdit(row) {
      row.title = row.originalTitle
      row.edit = false
      this.$message({
        message: 'The title has been restored to the original value',
        type: 'warning'
      })
    },
    confirmEdit(row) {
      row.edit = false
      row.originalTitle = row.title
      this.$message({
        message: 'The title has been edited',
        type: 'success'
      })
    }
  }
}
</script>

<style scoped>
  .edit-input {
    padding-right: 100px;
  }
  .cancel-btn {
    position: absolute;
    right: 15px;
    top: 10px;
  }
</style>

